﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SarahShop.Models;
namespace SarahShop.DataAccess
{
    public class Data
    {
        static SRSModelDataContext model = new SRSModelDataContext();

        public List<Slider> getSliders()
        {
            return model.Sliders.ToList();
        }

        public List<Product> getProducts()
        {
            return model.Products.ToList();
        }

        public Product getProduct(string pCode)
        {
            return model.Products.SingleOrDefault(p => p.Code == pCode);
        }

        public List<Product> random3Product()
        {
            return model.Products.Skip(0).Take(3).ToList();
        }
    }
}